<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- 基本表单 -->
        <form action="">
            <div>
                <label for="user">用户名</label>
                <input type="text" id="user" v-model="user">
                {{user}}
            </div>
            <!-- 不写v-model -->
            <div>
                <label for="age">年龄</label>
                <input type="text" id="age" ref="age" :value="age" @input="changeAgeFn($event)">
                {{age}}
            </div>



            <!-- 复选框 -->
            <div>
                <label for="">全选</label>
                <input type="checkbox" v-model="all">
                {{all}}
            </div>
            <!-- 不写v-model -->
            <div>
                <label for="">全bu选</label>
                <input type="checkbox" :checked="blue" @change="changeBlue($event)">
                {{blue}}
            </div>



            <div>
                <label for="down">下拉</label>
                <select name="down" id="">
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                </select>
            </div>

            <!--修饰符 text框 -->
            <div>
                <input type="text" v-model.trim.number.lazy="pink">
                {{pink}}-{{pink.length}}-{{typeof pink}}
            </div>
        </form>
    </div>
</body>
<script src="../vue.js"></script> 
<script>
    new Vue({
        el: "#app",
        data() {
            return {
                user: "泷奈",
                age: "15",
                all: true,
                blue: true,
                down: 2,
                pink: ""
            }
        },
        methods: {
            changeAgeFn(e) {
                // console.log(document.getElementById("age").value)

                // console.log(this.$refs.age.value)
                console.log(e.target.value)
                this.age = e.target.value
            },
            changeBlue(e) {
                console.log(e.target.checked)
                this.blue = e.target.checked
            }
        }
    })
</script>

</html>